<?php

use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
/**
 * Class CreateConfigTable
 *  生成迁移: php artisan make:migration create_auth_rule_table
 *  运行迁移: php artisan migrate
 */
class CreateAuthRuleTable extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::create('auth_rule', function (Blueprint $table) {
            $table->increments('id')->comment('编号');
            $table->string('href',80)->comment('地址');
            $table->string('title',100)->comment('名称');
            $table->tinyInteger('status')->default(1);
            $table->string('icon',80)->nullable(true)->comment('图标');
            $table->integer('pid')->comment('父栏目ID');
            $table->integer('sort')->nullable(true)->comment('排序');
            $table->tinyInteger('levels')->comment('层级');
            $table->tinyInteger('menustatus')->nullable(true)->comment('栏目状态');
            $table->integer('addtime')->comment('添加时间');
        });
        $prefix = DB::getConfig('prefix');
        DB::statement("ALTER TABLE `{$prefix}auth_rule` comment '权限节点'"); // 表注释
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        Schema::dropIfExists('auth_rule');
    }
}
